package com.nike.amoeba.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import androidx.appcompat.widget.AppCompatCheckBox;
import androidx.appcompat.widget.AppCompatTextView;

import com.nike.amoeba.R;
import com.nike.amoeba.bean.DataBean;

import java.util.List;

public class StockChuEpcAdapter extends BaseListViewAdapter<DataBean> {

    public StockChuEpcAdapter(Context act, List<DataBean> listBean) {
        super(act, listBean);
    }

    @Override
    protected View getCreateVieww(int position, View convertView, ViewGroup parent) {
        var bean = listBean.get(position);
        ViewHolder viewHolder;
        if (convertView == null) {
            convertView = convertView.inflate(act, R.layout.i_chu_epc, null);
            viewHolder=new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.tv_content.setText("：" + bean.getEPC());
        viewHolder.cb.setChecked(bean.getType() == 0 ? false : true);
        return convertView;
    }

    class ViewHolder{

        AppCompatTextView tv_content;
        AppCompatCheckBox cb;
        ViewHolder(View view) {
            cb = view.findViewById(R.id.cb_);
            tv_content = view.findViewById(R.id.tv_text);
        }
    }

}
